<template>
  <div class="sub-exciter-introduction">
    <!-- 页面头部 -->
    <div class="page-header">
      <el-page-header @back="goBack" content="副励磁机原理介绍">
        <template #title>
          <span class="header-title">整流发电机虚拟训练软件</span>
        </template>
        <template #extra>
          <div class="header-actions">
            <el-button type="primary" :icon="Printer" @click="handlePrint">打印</el-button>
            <el-button :icon="Download" @click="handleDownload">下载PDF</el-button>
          </div>
        </template>
      </el-page-header>
    </div>

    <!-- 内容区域 -->
    <div class="markdown-content">
      <!-- 标题区域 -->
      <h1 class="content-title">副励磁机原理与结构介绍</h1>

      <!-- 概述部分 -->
      <section class="content-section">
        <h2>1. 副励磁机概述</h2>
        <p>副励磁机是十二相整流发电机组励磁系统的重要组成部分，主要负责为自动电压调节器(AVR)和主励磁机提供初始励磁电源，是发电机建立电压的起始环节。</p>

        <p>在发电机组启动过程中，副励磁机首先建立电压，为主励磁机提供初始励磁电流，进而使主发电机建立电压，完成整个发电系统的启动过程。</p>

        <!-- 副励磁机在系统中的位置 -->
        <div class="image-placeholder">
          <p class="placeholder-text">[图：副励磁机在励磁系统中的位置]</p>
          <div class="placeholder-box">
            <span>副励磁机系统位置示意图</span>
          </div>
        </div>
      </section>

      <!-- 结构组成 -->
      <section class="content-section">
        <h2>2. 副励磁机结构组成</h2>

        <h3>2.1 主要组成部分</h3>
        <p>副励磁机采用永磁式或小容量电励磁结构，主要由以下部件组成：</p>

        <el-row :gutter="20">
          <el-col :span="12">
            <div class="component-list">
              <div class="component-item">
                <h4>永磁转子</h4>
                <ul>
                  <li>高性能永磁材料：钕铁硼或稀土永磁体</li>
                  <li>转子结构：凸极或隐极式设计</li>
                  <li>磁极固定：特殊工艺确保高速旋转稳定性</li>
                </ul>
              </div>

              <div class="component-item">
                <h4>定子电枢</h4>
                <ul>
                  <li>定子铁芯：高导磁硅钢片叠压</li>
                  <li>电枢绕组：分布式或集中式绕组</li>
                  <li>绝缘等级：F级或H级绝缘材料</li>
                </ul>
              </div>

              <div class="component-item">
                <h4>机壳与端盖</h4>
                <ul>
                  <li>防护等级：IP23或更高防护等级</li>
                  <li>散热设计：自然冷却或强制风冷</li>
                  <li>安装接口：与主发电机精确配合</li>
                </ul>
              </div>
            </div>
          </el-col>

          <el-col :span="12">
            <!-- 副励磁机结构示意图 -->
            <div class="image-placeholder">
              <p class="placeholder-text">[图：副励磁机内部结构示意图]</p>
              <div class="placeholder-box">
                <span>副励磁机结构分解图</span>
              </div>
            </div>
          </el-col>
        </el-row>

        <h3>2.2 技术特点</h3>
        <p>副励磁机具有以下显著技术特点：</p>

        <el-collapse v-model="activeCollapse">
          <el-collapse-item title="高可靠性设计" name="reliability">
            <p>采用永磁结构，无需外部励磁电源，简化系统结构，提高可靠性。</p>
            <ul>
              <li>无刷结构：减少维护工作量</li>
              <li>永磁激励：不依赖外部电源</li>
              <li>坚固结构：适应船舶振动环境</li>
            </ul>
          </el-collapse-item>

          <el-collapse-item title="快速建压特性" name="fastResponse">
            <p>在发电机转速达到一定值时即可建立稳定电压，确保系统快速启动。</p>
            <ul>
              <li>低转速建压：转速达到15-20%额定转速即可发电</li>
              <li>电压稳定：输出电压随转速变化小</li>
              <li>快速响应：满足系统快速启动要求</li>
            </ul>
          </el-collapse-item>

          <el-collapse-item title="紧凑型设计" name="compact">
            <p>体积小、重量轻，便于在有限空间内安装。</p>
            <ul>
              <li>小型化设计：与主发电机同轴安装</li>
              <li>轻量化：采用高强度轻质材料</li>
              <li>集成化：减少外部连接部件</li>
            </ul>
          </el-collapse-item>
        </el-collapse>
      </section>

      <!-- 工作原理 -->
      <section class="content-section">
        <h2>3. 副励磁机工作原理</h2>

        <h3>3.1 基本工作原理</h3>
        <p>副励磁机基于电磁感应原理工作，当发电机转子旋转时，副励磁机的永磁转子随之旋转，产生旋转磁场，该磁场切割定子电枢绕组产生感应电动势。</p>

        <p>产生的交流电经过整流后，为AVR和主励磁机提供工作电源，完成发电机组的初始励磁建立过程。</p>

        <!-- 副励磁机工作原理图 -->
        <div class="image-placeholder">
          <p class="placeholder-text">[图：副励磁机工作原理框图]</p>
          <div class="placeholder-box large">
            <span>副励磁机工作原理示意图</span>
            <p>展示永磁转子旋转产生交流电，经整流后供给AVR和主励磁机的过程</p>
          </div>
        </div>

        <h3>3.2 工作流程</h3>
        <ol>
          <li>原动机带动发电机转子旋转</li>
          <li>副励磁机永磁转子同步旋转</li>
          <li>旋转磁场切割定子电枢绕组</li>
          <li>电枢绕组中产生感应交流电动势</li>
          <li>交流电经整流装置转换为直流电</li>
          <li>直流电供给AVR控制电路</li>
          <li>AVR输出控制主励磁机励磁电流</li>
          <li>主发电机建立稳定电压</li>
        </ol>

        <!-- 励磁装置拓扑图 -->
        <div class="image-placeholder">
          <p class="placeholder-text">[图：励磁装置拓扑图]</p>
          <div class="placeholder-box">
            [](@replace=1)

          </div>
        </div>
      </section>

      <!-- 技术参数 -->
      <section class="content-section">
        <h2>4. 主要技术参数</h2>

        <el-table :data="technicalParams" stripe style="width: 100%">
          <el-table-column prop="parameter" label="参数名称" width="180"></el-table-column>
          <el-table-column prop="value" label="参数值" width="120"></el-table-column>
          <el-table-column prop="unit" label="单位" width="80"></el-table-column>
          <el-table-column prop="description" label="说明"></el-table-column>
        </el-table>

        <h3>4.1 性能特点</h3>
        <p>十二相整流发电机系统中的副励磁机具有以下性能特点：</p>

        <el-row :gutter="16">
          <el-col :span="8">
            <el-card shadow="hover" class="feature-card">
              <template #header>
                <div class="feature-header">
                  <el-icon><Lightning /></el-icon>
                  <span>自激特性</span>
                </div>
              </template>
              <div class="feature-content">
                <p>采用永磁结构，无需外部励磁电源，系统启动快速可靠</p>
              </div>
            </el-card>
          </el-col>

          <el-col :span="8">
            <el-card shadow="hover" class="feature-card">
              <template #header>
                <div class="feature-header">
                  <el-icon><TrendCharts /></el-icon>
                  <span>宽转速范围</span>
                </div>
              </template>
              <div class="feature-content">
                <p>在宽广的转速范围内都能稳定发电，适应不同工况</p>
              </div>
            </el-card>
          </el-col>

          <el-col :span="8">
            <el-card shadow="hover" class="feature-card">
              <template #header>
                <div class="feature-header">
                  <el-icon><Odometer /></el-icon>
                  <span>高功率密度</span>
                </div>
              </template>
              <div class="feature-content">
                <p>体积小、重量轻，功率密度高，适合空间受限场合</p>
              </div>
            </el-card>
          </el-col>
        </el-row>
      </section>

      <!-- 维护与故障处理 -->
      <section class="content-section">
        <h2>5. 维护与故障处理</h2>

        <h3>5.1 日常维护要点</h3>
        <el-timeline>
          <el-timeline-item timestamp="每日检查" placement="top">
            <el-card>
              <h4>日常检查项目</h4>
              <ul>
                <li>检查副励磁机运行声音是否正常</li>
                <li>监测输出电压是否稳定</li>
                <li>检查接线端子有无松动</li>
                <li>观察绝缘电阻变化趋势</li>
              </ul>
            </el-card>
          </el-timeline-item>

          <el-timeline-item timestamp="每月检查" placement="top">
            <el-card>
              <h4>月检项目</h4>
              <ul>
                <li>清洁副励磁机外部和通风孔</li>
                <li>测量绕组绝缘电阻</li>
                <li>检查永磁体磁性能</li>
                <li>记录运行参数变化</li>
              </ul>
            </el-card>
          </el-timeline-item>

          <el-timeline-item timestamp="年度检修" placement="top">
            <el-card>
              <h4>年度检修项目</h4>
              <ul>
                <li>全面拆卸检查</li>
                <li>永磁体性能检测</li>
                <li>绕组绝缘老化评估</li>
                <li>轴承更换（如必要）</li>
              </ul>
            </el-card>
          </el-timeline-item>
        </el-timeline>

        <h3>5.2 常见故障及处理</h3>

        <el-collapse v-model="activeFaults" accordion>
          <el-collapse-item title="无输出电压" name="noOutput">
            <div class="fault-content">
              <h4>故障现象：</h4>
              <ul>
                <li>副励磁机无电压输出</li>
                <li>发电机无法建立电压</li>
                <li>系统启动失败</li>
              </ul>

              <h4>可能原因：</h4>
              <ul>
                <li>永磁体退磁</li>
                <li>电枢绕组断路或短路</li>
                <li>接线端子脱落</li>
                <li>整流装置故障</li>
              </ul>

              <h4>处理方法：</h4>
              <ol>
                <li>检查永磁体磁性能</li>
                <li>测量电枢绕组电阻和绝缘</li>
                <li>检查所有接线连接</li>
                <li>测试整流装置工作状态</li>
              </ol>
            </div>
          </el-collapse-item>

          <el-collapse-item title="输出电压不稳定" name="unstable">
            <div class="fault-content">
              <h4>故障现象：</h4>
              <ul>
                <li>副励磁机输出电压波动</li>
                <li>发电机电压建立缓慢</li>
                <li>系统运行不稳定</li>
              </ul>

              <h4>可能原因：</h4>
              <ul>
                <li>永磁体局部退磁</li>
                <li>电枢绕组匝间短路</li>
                <li>连接部位接触不良</li>
                <li>轴承磨损导致气隙不均</li>
              </ul>

              <h4>处理方法：</h4>
              <ol>
                <li>检测永磁体磁通分布</li>
                <li>检查电枢绕组完整性</li>
                <li>紧固所有电气连接</li>
                <li>检查轴承状态和气隙均匀性</li>
              </ol>
            </div>
          </el-collapse-item>

          <el-collapse-item title="异常振动和噪声" name="vibration">
            <div class="fault-content">
              <h4>故障现象：</h4>
              <ul>
                <li>副励磁机运行时振动明显</li>
                <li>发出异常噪声</li>
                <li>轴承温度升高</li>
              </ul>

              <h4>可能原因：</h4>
              <ul>
                <li>轴承磨损或损坏</li>
                <li>转子动平衡失调</li>
                <li>安装基础松动</li>
                <li>永磁体脱落或移位</li>
              </ul>

              <h4>处理方法：</h4>
              <ol>
                <li>检查轴承状态并更换</li>
                <li>重新进行转子动平衡</li>
                <li>紧固安装螺栓</li>
                <li>检查永磁体固定状态</li>
              </ol>

              <!-- 故障诊断流程图 -->
              <div class="image-placeholder">
                <p class="placeholder-text">[图：副励磁机故障诊断流程图]</p>
                <div class="placeholder-box">
                  <span>异常振动故障诊断流程</span>
                </div>
              </div>
            </div>
          </el-collapse-item>
        </el-collapse>
      </section>

      <!-- 相关知识链接 -->
      <section class="content-section">
        <h2>6. 相关知识链接</h2>

        <div class="knowledge-links">
          <el-card
              v-for="link in relatedLinks"
              :key="link.title"
              class="link-card"
              @click="navigateTo(link.path)"
          >
            <template #header>
              <div class="card-header">
                <el-icon><Connection /></el-icon>
                <span>{{ link.title }}</span>
              </div>
            </template>
            <div class="card-content">
              <p>{{ link.description }}</p>
              <div class="card-actions">
                <el-tag :type="link.type" size="small">{{ link.category }}</el-tag>
              </div>
            </div>
          </el-card>
        </div>
      </section>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue';
import { useRouter } from 'vue-router';
import { Printer, Download, Connection, TrendCharts, Lightning, Odometer } from '@element-plus/icons-vue';

const router = useRouter();
const activeCollapse = ref(['reliability']);
const activeFaults = ref(['noOutput']);

// 技术参数数据
const technicalParams = ref([
  {
    parameter: '额定输出电压',
    value: '110',
    unit: 'V',
    description: '额定转速下的交流输出电压'
  },
  {
    parameter: '额定输出功率',
    value: '500',
    unit: 'W',
    description: '最大持续输出功率'
  },
  {
    parameter: '工作频率',
    value: '400',
    unit: 'Hz',
    description: '额定转速下的输出频率'
  },
  {
    parameter: '建压转速',
    value: '15',
    unit: '%',
    description: '开始建立电压的转速百分比'
  },
  {
    parameter: '绝缘等级',
    value: 'F',
    unit: '',
    description: '绕组绝缘耐热等级'
  },
  {
    parameter: '防护等级',
    value: 'IP23',
    unit: '',
    description: '防滴防尘等级'
  },
  {
    parameter: '工作温度',
    value: '-20~40',
    unit: '℃',
    description: '环境工作温度范围'
  },
  {
    parameter: '冷却方式',
    value: 'IC01',
    unit: '',
    description: '自冷式通风冷却'
  }
]);

// 相关知识链接
const relatedLinks = ref([
  {
    title: '主励磁机原理',
    description: '了解主励磁机与副励磁机的协同工作原理',
    path: '/principle/exciter',
    category: '励磁系统',
    type: 'primary'
  },
  {
    title: '自动电压调节器(AVR)',
    description: '学习AVR如何利用副励磁机电源调节发电机电压',
    path: '/principle/avr',
    category: '控制系统',
    type: 'success'
  },
  {
    title: '旋转整流器原理',
    description: '了解副励磁机输出电能的整流过程',
    path: '/principle/rotating-rectifier',
    category: '电力电子',
    type: 'warning'
  },
  {
    title: '发电机组启动流程',
    description: '掌握包含副励磁机在内的完整发电机组启动过程',
    path: '/principle/control-panel',
    category: '操作规程',
    type: 'danger'
  }
]);

const goBack = () => {
  router.back();
};

const handlePrint = () => {
  window.print();
};

const handleDownload = () => {
  // 实现PDF下载功能
  console.log('下载PDF');
};

const navigateTo = (path) => {
  router.push(path);
};
</script>

<style scoped>
.sub-exciter-introduction {
  padding: 20px;
  background-color: #f5f7fa;
  min-height: 100vh;
}

.page-header {
  margin-bottom: 24px;
  background-color: #fff;
  padding: 16px;
  border-radius: 4px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}

.header-title {
  font-size: 18px;
  font-weight: bold;
}

.header-actions {
  display: flex;
  gap: 10px;
}

.markdown-content {
  background-color: #fff;
  padding: 24px;
  border-radius: 4px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}

.content-title {
  font-size: 28px;
  color: #303133;
  text-align: center;
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 2px solid #409eff;
}

.content-section {
  margin-bottom: 40px;
}

.content-section h2 {
  font-size: 22px;
  color: #303133;
  margin-bottom: 16px;
  padding-left: 8px;
  border-left: 4px solid #409eff;
}

.content-section h3 {
  font-size: 18px;
  color: #606266;
  margin: 16px 0 12px 0;
}

.content-section h4 {
  font-size: 16px;
  color: #909399;
  margin: 12px 0 8px 0;
}

.content-section p {
  line-height: 1.6;
  color: #606266;
  margin-bottom: 16px;
}

.content-section ul, .content-section ol {
  padding-left: 24px;
  margin-bottom: 16px;
}

.content-section li {
  line-height: 1.6;
  color: #606266;
  margin-bottom: 8px;
}

/* 图片占位符样式 */
.image-placeholder {
  margin: 20px 0;
  text-align: center;
}

.placeholder-text {
  font-style: italic;
  color: #909399;
  margin-bottom: 10px;
}

.placeholder-box {
  border: 2px dashed #dcdfe6;
  border-radius: 4px;
  padding: 40px 20px;
  background-color: #fafafa;
  color: #909399;
}

.placeholder-box.large {
  min-height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.placeholder-box img {
  max-width: 100%;
  height: auto;
}

/* 组件列表样式 */
.component-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.component-item {
  background-color: #f8f9fa;
  padding: 16px;
  border-radius: 4px;
  border-left: 4px solid #409eff;
}

.component-item h4 {
  margin-top: 0;
  color: #303133;
}

/* 特性卡片样式 */
.feature-card {
  height: 100%;
}

.feature-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: bold;
}

.feature-content {
  min-height: 60px;
}

/* 故障内容样式 */
.fault-content h4 {
  color: #606266;
  margin: 16px 0 8px 0;
}

.fault-content ul, .fault-content ol {
  margin-left: 20px;
}

/* 知识链接样式 */
.knowledge-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.link-card {
  cursor: pointer;
  transition: transform 0.3s, box-shadow 0.3s;
  height: 100%;
}

.link-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: bold;
}

.card-content {
  min-height: 80px;
}

.card-actions {
  margin-top: 12px;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .sub-exciter-introduction {
    padding: 12px;
  }

  .markdown-content {
    padding: 16px;
  }

  .content-title {
    font-size: 24px;
  }

  .content-section h2 {
    font-size: 20px;
  }

  .content-section h3 {
    font-size: 16px;
  }

  .knowledge-links {
    grid-template-columns: 1fr;
  }

  .header-actions {
    flex-direction: column;
    gap: 8px;
  }
}

/* 打印样式 */
@media print {
  .page-header, .header-actions {
    display: none;
  }

  .sub-exciter-introduction {
    padding: 0;
    background-color: #fff;
  }

  .markdown-content {
    padding: 0;
    box-shadow: none;
  }

  .placeholder-box {
    border: 1px solid #ccc;
    background-color: #fff;
  }
}
</style>